/*
 * @Author: szx
 * @Date: 2022-06-30 12:57:31
 * @LastEditTime: 2022-06-30 13:08:37
 * @Description:
 * @FilePath: \leetcode\500-599\522\522.js
 */
/**
 * @param {string[]} strs
 * @return {number}
 */
var findLUSlength = function (strs) {
    let res = -1;
    for (let [i, s] of strs.entries) {
        if (s.length > res) {
            for (let [j, s_] of strs.entries()) {
                if (j != i && isSubStr(s, s_)) {
                    break;
                }
            }
            res = s.length;
        }
    }
    return res;
};
function isSubStr(s1, s2) {
    const m = s1.length,
        n = s2.length;
    if (m > n) return false;
    let i = 0;
    for (let j = 0; (i < m) & (j < n); j++) {
        if (s1[i] == s2[j]) i++;
    }
    return i == m;
}
